package com.scqkxx.gamebox.activity.news.adapter;

import android.widget.ImageView;

import com.avos.avoscloud.AVObject;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.scqkxx.gamebox.R;

import java.text.SimpleDateFormat;
import java.util.List;

/**
 * Created by admin on 2018/8/15. 09点37分
 * name: 唐师
 * 用途 ： 游戏页面的适配器
 */

public class NewsDetailAdapter extends BaseQuickAdapter<AVObject, BaseViewHolder> {

    public NewsDetailAdapter(int layoutResId, List<AVObject> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, AVObject item) {
        helper.setText(R.id.tv_mark_name, item.getString("title"));
        helper.setText(R.id.tv_mark_time, new SimpleDateFormat("yyyy年MM月dd日 HH:mm").format(item.getCreatedAt())+"标记");

        RequestOptions options = new RequestOptions()
                .placeholder(R.mipmap.icon_user_header_default)
                .error(R.mipmap.icon_user_header_default)
                .centerCrop()
                .circleCrop();
        Glide.with(mContext)
                .load(item.getString("avatar"))
                .apply(options)
                .into((ImageView) helper.convertView.findViewById(R.id.iv_mark_img));
    }
}
